<!--  -->
<template>
  <div class='order-page'>
    <van-sticky>
      <c-title :hide="false" text="报名记录"></c-title>
      <div class="order-head">
        <van-search v-model="query.student_keyword" placeholder="输入学员姓名/手机号" @search="orderSearch"  shape="round" />
        <van-tabs v-model="query.status" @change="onOrderChange" round color="var(--themeBaseColor)" title-active-color="var(--themeBaseColor)" title-inactive-color="#00001C" line-width="15px">
          <block v-for="(item, index) in tabList" :key="index">
            <van-tab :title="item.name" :name="item.status"></van-tab>
          </block>
        </van-tabs>
      </div>
    </van-sticky>
    <div class="mb20"></div>
    <div class="order-content" v-if="orderList.length > 0">
      <block v-for="(item,index) in orderList" :key="index">
        <div class="order-item" >
          <div class="title flex-j-sb">
            <div class="left flex-a-c">
              <div class="title-name">订单号：{{item.order_sn}}</div>
            </div>
            <div class="right">{{item.status_name}}</div>
          </div>
          <div class="card-wrap flex" @click="ondetails(item)">
            <div class="img">
              <img :src="item.goods.thumb_link" />
            </div>
            <div class="card-main flex">
              <div class="flex-j-sb flex-a-c flex-w">
                <div class="name ell">{{item.goods && item.goods.title}}</div>
              </div>
              <div class="price">¥{{item.price}}</div>
            </div>
          </div>
          <div class="apply-student">
            <h3>报名学员：{{item.relation_name}}</h3>
            <p>截止时间：{{item.goods && item.goods.end_time}}</p>
          </div>
          <div class="order-footer flex">
            <!-- <div class="total">合计 ：￥{{ setItem.has_many_order_goods[0] && setItem.has_many_order_goods[0].payment_amount }}</div> -->
            <div class="order-btns flex-a-c" >
                <div v-for="(itemBtn, btnIndex) in item.button_models" :key="btnIndex"
                  class="order-buy btn flex-a-c flex-j-c"
                  :class="itemBtn.value === 1? 'order-evaluate' : ''"
                  @click="getorderState({
                    value:itemBtn.value, 
                    id:item.id,
                    refundId:item.refund_id, 
                    api:itemBtn.api
                  })">
                  {{ itemBtn.name }}
                </div>
            </div>
          </div>
        </div>
      </block>
      
    </div>
    <van-empty description="暂无数据" v-else />
    <van-dialog id="van-dialog" />
    <div class="mb-50"></div>
  </div>
</template>

<script>
import applyOrder_controller from './applyOrder_controller';
export default applyOrder_controller;
</script>
<style lang="scss" scoped>
/* @import url(); 引入公共css类 */
  ::v-deep .van-tabs__line {
    bottom:1.25rem;
  }
  .mb-50 {
    height: 3.125rem;
    clear: both;
  }
  /* @import url(); 引入公共css类 */
.ell {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;

  /* 定义显示的行数 */
  overflow: hidden;
}

.mb20 {
  height: 10px;
  clear: both;
}
.order-content {
  margin:0 0.75rem;
}
  .order-item {
    background-color: #fff;
    padding: 0.8125rem 0.625rem;
    border-radius: 0.5rem 0.5rem 0.5rem 0.5rem;
    margin:0 0 0.625rem 0;
  }

  .order-item .title {
    align-items: center;
  }

  .title-icon-bg {
    width: 1.0625rem;
    height: 1.0625rem;
    margin-right: 0.3125rem;

    img {
      width: 1.0625rem;
      height: 1.0625rem;
    }
  }

  .title-name {
    font-size: 0.8125rem;
    color: #00001C
  }

  .right {
    font-size: 0.875rem;
    color: #F15353;
  }

  .card-wrap {
    margin: 10px 0 0 0;

    .img img {
      width: 5.375rem;
      height: 3.4375rem;
      border-radius: 0.5rem 0.5rem 0.5rem 0.5rem;
    }
  }

  .card-main {
    margin: 0 0 0 0.6875rem;
    flex: 3;
    flex-direction: column;
    justify-content: space-between;
    .name {
      font-size: 0.875rem;
      color: #00001C;
    }

    .price {
      font-weight: bold;
      font-size: 0.875rem;
      color: #F15353;
      text-align:left;
    }

   
  }
  .apply-student {
    background: #FBFBFB;
    border-radius: 0.5rem 0.5rem 0.5rem 0.5rem;
    padding:0.5625rem 0.6875rem;
    text-align: left;
    margin:1rem 0 0 0;
    font-weight: 400;
    font-size: 0.8125rem;
    color: #9898A1;

    h3 {
      padding:0 0 0.25rem 0;
    }
  }

  .order-footer {
    flex-direction: column;

    .total {
      font-size: 0.875rem;
      color: #333;
      text-align: right;
    }
  }

  .order-btns {
    justify-content: flex-end;
    margin-top: 0.9375rem;
    // flex-wrap: wrap;

    .btn {
      width: 5rem;
      height: 2.0625rem;
      border-radius: 0.3125rem;
    }

    .order-buy {
      border: 0.0625rem solid #AAAAB3;
      font-size: 0.8125rem;
      color: #222;
      margin: 0 0.5rem 0 0;
      background-image: #fff;
      cursor: pointer;
      border-radius: 1.875rem 1.875rem 1.875rem 1.875rem;
    }

    .order-evaluate {
      background-color: #F15353;
      font-size: 0.8125rem;
      color: #fff;
      // margin: 0 0.375rem 0.375rem  0;
      border: none;
    }
  }

  .order-btns .order-buy:last-child,
  .order-btns .order-evaluate:last-child {
    margin-right: 0;
  }
</style>